package com.googlecode.chios.jnet.handler;

import com.googlecode.chios.jnet.buffer.ChannelBuffer;
import com.googlecode.chios.jnet.io.Session;

public class ReadTask implements Task {
	
	private Session session;
	
	private ChannelBuffer buffer;
	
	public ReadTask(Session session, ChannelBuffer buffer) {
		this.session = session;
		this.buffer = buffer;
	}

	@Override
	public void run() {
		Object msg = session.configration().decoder.decode(buffer);
		if(msg == null) {
			return;
		}
		
		session.configration().bussinessHandler.messageReceived(session, msg);
	}

}
